home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7600 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: access1.digex.net!not-for-mail
  2. From: ell@access1.digex.net (Ell)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Constructor classes
  5. Date: 24 Feb 1996 01:49:30 GMT
  6. Organization: The Universe
  7. Message-ID: <4glqra$c6p@news4.digex.net>
  8. References: <4gi8es$4gn@daily-planet.execpc.com> <312CC9CA.473F@wpo.borland.com>
  9. NNTP-Posting-Host: access1.digex.net
  10. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  11.  
  12. : Sherri Scalish wrote:
  13. : > 
  14. : > Hope someone can help me, I'm getting very frustrated.  I have a container
  15. : > class in which I have an array of classes:
  16. : > 
  17. : >         class OtherClass{
  18. : >         private:
  19. : >                 char m_itema[30];
  20. : >                 char m_itemb[30];
  21. : >                 ...
  22. : >         }:
  23. : > 
  24. : >         class ContainerClass{
  25. : >         public:
  26. : >                 OtherClass Items[9];
  27. : >         ...
  28. : >         };
  29. : > 
  30. : > 
  31. : > How do I access the array's data members?  I have tried:
  32. : >         m_itema[0], ContainerClass->m_itema[0], ContainerClass.m_itema[0],
  33. : > OtherClass->m_itema[0]. OtherClass.m_itema[0], etc. etc.
  34.  
  35. You can not access the private members of another class, unless you are a 
  36. friend.
  37.  
  38. Elliott
  39.